package net.cyndeline.components.world

import java.util.UUID
import net.cyndeline.GameMap.LevelMap
import net.cyndeline.entitySystem.Component

/**
 * Part of a globally unique entity. Stores every map grid and
 * its content.
 */
trait MapRegistryComponent extends Component {
  
  /** Adds a map to the registry. */
  def addMap(id: UUID, map: LevelMap): Unit
}

class MapRegistry extends MapRegistryComponent {
  private var maps = Map[UUID, LevelMap]()
  
  override def addMap(id: UUID, map: LevelMap) {
    maps += (id -> map)
  }
  
  override def copy = {
    val copy = new MapRegistry()
    // TODO Write copy
    copy
  }
}